package cn.com.agameofthrones.AGoTLCGCards;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class AGoTAlertDialog extends Activity implements View.OnClickListener {
	private EditText edit_text;
	Button btnOK, btnCancel;
	@Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LayoutInflater inflater = LayoutInflater.from(this);
	View main = inflater.inflate(R.layout.alert_dialog, null);
	edit_text=(EditText) main.findViewById(R.id.editText_ID);
	//edit_text.setText(card_id);
	btnOK=(Button) main.findViewById(R.id.button_OK);
	btnOK.setOnClickListener(this);
	btnCancel=(Button) main.findViewById(R.id.Button_Cancel);
	btnCancel.setOnClickListener(this);
    setContentView(main);
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v==btnOK){
			Intent result=new Intent();
			result.putExtra("card_id", edit_text.getText().toString());
			setResult(RESULT_OK,result);
			finish();
		}
		if(v==btnCancel){
			setResult(RESULT_CANCELED);
			finish();
		}
	}
}
